var app = getApp();
Page({

  data: {
    msgList: [],
    loading: false,
    nodata: false,
    nomore: false,
    pageInfo: { article: {} },
    page: 1,
  },

  onLoad: function (options) {
    var that = this;
    this.page = 1;
    this.loadArchives();
  },
    onPullDownRefresh: function () {
        this.page = 1;
        this.loadArchives(function () {
            wx.stopPullDownRefresh();
        });
    },
    onReachBottom: function () {
        var that = this;
        this.loadArchives(function (data) {
            if (data.msgList.length == 0) {
                app.info("暂无更多数据");
            }
        });
    },
    loadArchives: function (cb) {
        this.setData({ loading: true });
        var that = this;
        //这里读取关闭我们信息
        app.request('/my/getMsg',{page:this.page},function (data) {
            that.setData({
                loading: false,
                nodata: that.page == 1 && data.msgList.length == 0 ? true : false,
                nomore: that.page > 1 && data.msgList.length == 0 ? true : false,
                msgList: that.page > 1 ? that.data.msgList.concat(data.msgList) : data.msgList
            });
            that.page++;
            typeof cb == 'function' && cb(data);
        }, function (data, ret) {
            app.error(ret.msg);
        });
    },
})